<!--
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-03-07 15:32:29
 * @LastEditors: huangtianyang
 * @LastEditTime: 2023-06-02 15:43:51
 * @FilePath: \cxl-h5\src\pages\protocol\Index.vue
-->
<template>
    <section class="protocol-container" v-html="html"></section>
</template>

<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { ProtocolType } from '@/utils/config'
import { getProtocol } from '@/apis/protocol'
import useWeixinSdk from '@/utils/WXSdk'
import { editPageTitle } from '@/utils'
const router = useRoute()
const key = router.params.type
console.log(ProtocolType, router.params.type, ProtocolType[key as keyof typeof ProtocolType])
const title: string = ProtocolType[router.params.type as keyof typeof ProtocolType]
//设置页面标题
// window.document.title = title
//协议内容
const html = ref('')
onMounted(() => {
    editPageTitle(title)
    getProtocol(key as string).then(res => {
        if (res.data.value === 200) {
            html.value = res.data.data
        }
    })
    useWeixinSdk.disableShare()
})
</script>

<style scoped lang="scss">
.protocol-container {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding: var(--cxl-size-16);
    margin-bottom: env(safe-area-inset-bottom);
}
</style>
